//
//  LLNavigationMidSearchItem.m
//  BestLearning
//
//  Created by apple on 2017/2/21.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "LLNavigationMidSearchItem.h"

@interface LLNavigationMidSearchItem ()



@property(nonatomic, strong) UIButton *searchButton;

@end

@implementation LLNavigationMidSearchItem

-(instancetype)initWithFrame:(CGRect)frame{
    
   self = [super initWithFrame:frame];
    
    if (self) {
        
        self.backgroundColor = [UIColor whiteColor];
        self.layer.cornerRadius = 5.0f;
        self.layer.masksToBounds = YES;
        
        
        _searchField = [[UITextField alloc]init];
        _searchField.placeholder = @"请输入学生姓名/家长联系方式";
        _searchField.textColor = ColorRGB(204, 204, 204);
        _searchField.font = [UIFont systemFontOfSize:14];
        _searchField.clearButtonMode = UITextFieldViewModeWhileEditing;
        _searchField.leftViewMode = UITextFieldViewModeAlways;
        _searchField.rightViewMode = UITextFieldViewModeAlways;
        [self addSubview:_searchField];
        
        //左边图标
        UIView *leftBgView = [[UIView alloc]init];
        leftBgView.frame = CGRectMake(0, 0, 25, 25);
        
        UIImageView *searchImageVie= [[UIImageView alloc]init];
        searchImageVie.frame = CGRectMake(5, 3, 18, 18);
        searchImageVie.image = [UIImage imageNamed:@"icon_search_default"];
    
        [leftBgView addSubview:searchImageVie];
        
        
        _searchField.leftView = leftBgView;
        
    }

    return self;
}

-(void)layoutSubviews{

    [super layoutSubviews];
    
    
    //_searchImageView.frame = CGRectMake(10, 7, buttonW, butotnH);
    
    //_scanButton.frame = CGRectMake(self.width - buttonW - 5, 7, buttonW, butotnH);
    
    _searchField.frame = CGRectMake(0, 0, self.width, self.height);
    
    
}



    
@end
